//
// Created by liushuai on 2020/1/31.
//
#include "moveZeroes.h"
void moveZeroes(vector<int>& nums){
    bool flag = false;
    int count = 0;
    for(auto iter = nums.begin();iter!=nums.end()&&count!=nums.size();iter++){
        int temp = 0;
        count+=1;
        if(flag)
            iter--;
        if(*iter==0){
            temp = *iter;
            nums.erase(iter);
            nums.insert(nums.end(),temp);
            flag = true;
        }else{
            flag = false;
        }

    }
}
